package app.listener

import im.mange.shoreditch.engine.ScriptEventListener
import im.mange.shoreditch.hipster._
import org.joda.time.LocalDateTime
import app.server.ServerActor
import im.mange.shoreditch.hipster.VersionedService
import im.mange.shoreditch.hipster.Check
import im.mange.shoreditch.hipster.Action

case class ServerActorListener(serverActor: ServerActor) extends ScriptEventListener {
  override def beforeStarted(script: Script, testId: String) {}
  override def validated(testRunId: String, versionedServices: List[VersionedService]) {}
  override def started(when: LocalDateTime, script: Script) {}
  override def stopped(when: LocalDateTime, script: Script) { serverActor.removeActive(script.testRunId.get) }
  override def running(step: Step) {}
  override def failure(action: Action, reasons: List[String]) {}
  override def success(action: Action) {}
  override def failure(check: Check, reasons: List[String]) {}
  override def success(check: Check) {}
}
